package com.zhihuishu.micro.course.service.impl;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.zhihuishu.micro.course.dao.CourseFolderMapper;
import com.zhihuishu.micro.course.dao.UserMapper;
import com.zhihuishu.micro.course.model.CourseFolder;
import com.zhihuishu.micro.course.model.User;
import com.zhihuishu.micro.course.service.CourseFolderService;
/**
 * 
     * Title: CourseFolderServiceImpl.java    
     * Description: 课程资料文件夹业务实现类
     * @author  嵇鹏
     * @created 2016年7月21日 上午9:06:24
 */
@Service("courseFolderService")
public class CourseFolderServiceImpl extends BaseService implements CourseFolderService {

	@Resource
	private UserMapper userMapper;
	@Resource
	private CourseFolderMapper courseFolderMapper;
	@Override
	public void saveDefaultCourseFolder(Long userId, Long courseId,Long ccCourseId) {
		CourseFolder courseFolder=new CourseFolder();
		courseFolder.setName("全部文件");
		courseFolder.setUserId(userId);
		courseFolder.setCcCourseId(ccCourseId);
		courseFolder.setCourseId(courseId);
		User loginUser = userMapper.findUserByUserId(userId);
		if(null != loginUser){
			courseFolder.setUserName(loginUser.getRealName());		
		}
		courseFolderMapper.save(courseFolder);
		
		
	}

}
